package com.xinhua.erp.test;

import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("user")
public class test {

    @PostMapping("login")
    public Map userlogin(){
        HashMap hashMap = new HashMap();
        HashMap map = new HashMap();
        map.put("token","admin");
        hashMap.put("code",20000);
        hashMap.put("data",map);
        return hashMap;
    }

    @GetMapping("info")
    public Map info(){
        HashMap hashMap = new HashMap();
        hashMap.put("code",20000);
        hashMap.put("data",new user());
        return hashMap;
    }
}


class user{
    Long id;
    List<String> roles;
    String introduction="I am a super administrator";
    String avatar="https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif";
    String name="Super Admin";

    public user(){
        roles=new ArrayList();
        roles.add("admin");

    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public List<String> getRoles() {
        return roles;
    }

    public void setRoles(List<String> roles) {
        this.roles = roles;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}